package com.xiaohu.demo;

import java.awt.Color;
import java.awt.Graphics;
import java.awt.Image;
import java.awt.Toolkit;

/**
 * 画点线程
@author XiaoHu
@date 2018-11-22
 */
public class VutilsThread implements Runnable{

	private static int i;
	private Theodolite theodolite;
	private static int 	X0=88;
	private static int 	Y0=700;
	
	public VutilsThread(Theodolite theodolite){
		this.theodolite=theodolite;
	}
	
	@Override
	public void run() {
		
		Graphics g = theodolite.getGraphics();
//		Toolkit tool = theodolite.getToolkit();
//		Image img = null;
//        try {
//        	img = tool.getImage("./image/feiji.jpg");
//		} catch (Exception e) {
//			System.out.println("没找到");
//		}
//        g.drawImage(img, 50, 50, theodolite);
		
		for(i=0;i<15;i++){
			//设置速度
			Theodolite.setVField(i+"");
			try {
				if(i==14){
					i=0;
				}
				Thread.sleep(2000);
				
				g.setColor(Color.white);
				if(i==0){
					g.drawString("•",X0,Y0);
					
				}else{
					g.drawString("•",X0+=20,Y0-5*i);
				}
				
			} catch (InterruptedException e) {
				e.printStackTrace();
			}
		}
		
	}
	
}
